package com.pgeg.listener;

import com.pgeg.materials.ModToolMaterials;
import com.pgeg.registry.ItemGroupRegistry;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.item.Item;
import net.minecraft.item.SwordItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.item.ToolMaterials;

public class WeaponsListener {

    /*Swords*/
    public static final Item ORICHALCUM_SWORD = genSettings(ModToolMaterials.ORICHALCUM, 3, -2.4F);
    public static final Item SATURNIUM_SWORD = genSettings(ModToolMaterials.SATURNIUM, 3, -2.4F);
    public static final Item BRIMSTONE_SWORD = genSettings(ModToolMaterials.BRIMSTONE, 3, -2.4F);
    public static final Item METEORITE_SWORD = genSettings(ModToolMaterials.METEORITE, 3, -2.4F);
    public static final Item MITHRIL_SWORD = genSettings(ModToolMaterials.MITHRIL, 3, -2.4F);
    public static final Item SCYTHE_DARK = genSettings(ModToolMaterials.MITHRIL, 3, -2.4F);
    public static final Item COPPER_SWORD = genSettings(ModToolMaterials.COPPER_TOOL_MATERIALS, 0, -3.0F);
    public static final Item SILVER_SWORD = genSettings(ModToolMaterials.SILVER_TOOL_MATERIALS, 0, -3.0F);
    public static final Item SANDSTONE_SWORD = genSettings(ModToolMaterials.SANDSTONE_TOOL_MATERIALS, 0, -2.0F);
    public static final Item REDSTONE_SWORD = genSettings(ModToolMaterials.REDSTONE_TOOL_MATERIALS, 0, -3F);

    /*Katanas*/
    public static final Item KATANA_DIAMOND = genSettings(ToolMaterials.DIAMOND, 9, -2.4F);
    public static final Item KATANA_GOLD = genSettings(ToolMaterials.GOLD, 9, -2.4F);
    public static final Item KATANA_IRON = genSettings(ToolMaterials.IRON, 9, -2.4F);
    public static final Item KATANA_NETHERITE = genSettings(ToolMaterials.NETHERITE, 9, -2.4F);
    public static final Item KATANA_STONE = genSettings(ToolMaterials.STONE, 9, -2.4F);
    public static final Item KATANA_WOOD = genSettings(ToolMaterials.WOOD, 9, -2.4F);

    /*BattleAxes*/
    public static final Item BATTLE_AXE_DIAMOND = genSettings(ToolMaterials.DIAMOND, 8, -2.4F);
    public static final Item BATTLE_AXE_GOLD = genSettings(ToolMaterials.GOLD, 8, -2.4F);
    public static final Item BATTLE_AXE_IRON = genSettings(ToolMaterials.IRON, 8, -2.4F);
    public static final Item BATTLE_AXE_NETHERITE = genSettings(ToolMaterials.NETHERITE, 8, -2.4F);
    public static final Item BATTLE_AXE_STONE = genSettings(ToolMaterials.STONE, 8, -2.4F);
    public static final Item BATTLE_AXE_WOOD = genSettings(ToolMaterials.WOOD, 8, -2.4F);

    /*Daggers*/
    public static final Item DAGGER_DIAMOND = genSettings(ToolMaterials.DIAMOND, 7, -2.4F);
    public static final Item DAGGER_GOLD = genSettings(ToolMaterials.GOLD, 7, -2.4F);
    public static final Item DAGGER_IRON = genSettings(ToolMaterials.IRON, 7, -2.4F);
    public static final Item DAGGER_NETHERITE = genSettings(ToolMaterials.NETHERITE, 7, -2.4F);
    public static final Item DAGGER_STONE = genSettings(ToolMaterials.STONE, 7, -2.4F);
    public static final Item DAGGER_WOOD = genSettings(ToolMaterials.WOOD, 7, -2.4F);

    /*LongSwords*/
    public static final Item LONGSWORD_DIAMOND = genSettings(ToolMaterials.DIAMOND, 7, -2.4F);
    public static final Item LONGSWORD_GOLD = genSettings(ToolMaterials.GOLD, 7, -2.4F);
    public static final Item LONGSWORD_IRON = genSettings(ToolMaterials.IRON, 7, -2.4F);
    public static final Item LONGSWORD_NETHERITE = genSettings(ToolMaterials.NETHERITE, 7, -2.4F);
    public static final Item LONGSWORD_STONE = genSettings(ToolMaterials.STONE, 7, -2.4F);
    public static final Item LONGSWORD_WOOD = genSettings(ToolMaterials.WOOD, 7, -2.4F);

    /*Rapiers*/
    public static final Item RAPIER_DIAMOND = genSettings(ToolMaterials.DIAMOND, 7, -2.4F);
    public static final Item RAPIER_GOLD = genSettings(ToolMaterials.GOLD, 7, -2.4F);
    public static final Item RAPIER_IRON = genSettings(ToolMaterials.IRON, 7, -2.4F);
    public static final Item RAPIER_NETHERITE = genSettings(ToolMaterials.NETHERITE, 7, -2.4F);
    public static final Item RAPIER_STONE = genSettings(ToolMaterials.STONE, 7, -2.4F);
    public static final Item RAPIER_WOOD = genSettings(ToolMaterials.WOOD, 7, -2.4F);

    private static SwordItem genSettings(ToolMaterial material, int damage, float speed) {
        return new SwordItem(material, damage, speed, new FabricItemSettings().group(ItemGroupRegistry.COMBAT_GROUP));
    }
}
